#ifndef GPIO_PWM_THREAD_H
#define GPIO_PWM_THREAD_H

#include <QThread>

class gpio_pwm_thread : public QThread
{
    Q_OBJECT
private:
    qint64 duty = 0;    //占空比时间，单位纳秒
    qint64 period = 0;  //周期，单位纳秒
    bool is_pwm_out = true;     //是否输出PWM
    bool is_pwm_exist = true;   //pwm是否存在

public:
    explicit gpio_pwm_thread();

public:
    void set_pwm_out(bool state);
    void set_period(qint64 period);
    void set_duty(qint64 duty);
    void set_pwm_exist(bool state);

protected:
    void run() override;

signals:
    void duty_time_out();   //占空比电平输出时间超时信号
    void period_time_out(); //PWM周期超时时间

};

#endif // GPIO_PWM_THREAD_H
